<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ include file="/WEB-INF/views/public/main.jsp"%>
<ul>
	<li><a href="#">Districts - <c:out
				value="${sessionScope.stateName}" />
	</a></li>
</ul>

<div id="districtModule" class="tab_padding">
<script type="text/javascript" src="${resourceUrl}/js/module_district.js"></script>
	<h3>
		Manage Districts -
		<c:out value="${sessionScope.stateName}" />
	</h3>
	<c:choose>
		<c:when test="${districtList.size() > 0}">

			<table id="districtModule_table" class="bordertable">
				<tr>
					<th>District</th>
					<th>Delete</th>
				</tr>
				<c:forEach var="district" items="${districtList}">
					<tr>
						<td>${district.getName()}</td>
						<td><a class="districtModuleDeleteDistrict"
							href="${rootUrl}secure/admin/district/delete/$${district.getId()}">Delete</a></td>
					</tr>
				</c:forEach>
			</table>
		</c:when>
		<c:otherwise>
			<table id="districtModule_table" class="bordertable">
				<tr>
					<th>District</th>
					<th>Delete</th>
				</tr>
			</table>
			<br />
			<p>No districts are added to the state. Click the Add button to
				add new district.</p>
		</c:otherwise>
	</c:choose>
	<br />
	<button id="districtModule_add_button"
		class="customButton">Add
		District</button>
	<div id="districtModule_add_dialog" class="dialog"
		title="Add new District">
		<form:form method="POST" id="districtModule_add_form"
			action="${rootUrl}secure/admin/district/add" commandName="district" class="noEnterSubmit">
			<fieldset class="ui-helper-reset">
				<table>
					<tr>
						<td class="label"><label id="lname" for="name">District
								Name</label></td>
						<td><form:input path="name" id="name" size="25"
								class="required" minlength="3"></form:input></td>
					</tr>
				</table>
			</fieldset>
		</form:form>
		<label id="districtModule_add_dialog_status"></label>

	</div>
	<div id="districtModule_delete_dialog" class="dialog"
		title="Delete District">
		<p>
			Do you really want to delete the district of '<span
				id="districtModule_delete_message"></span>' ?
		</p>

		<label id="districtModule_delete_dialog_status"></label>
	</div>
	<script type="text/javascript">
		onDistrictListLoad();
	</script>
</div>

